package com.zhifa.controller;

import java.util.List;


import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zhifa.Util.ComboboxUtil;
import com.zhifa.Util.ResponseUtil;
import com.zhifa.entity.Title;
import com.zhifa.service.TitleService;

import net.sf.json.JSONArray;

@Controller
@RequestMapping("/titles")
public class TitleController {

	@Resource
	TitleService titleService;
	
	@RequestMapping("/get")
	public String findTitlesByid(HttpServletResponse response) throws Exception{
		List<Title> titles = titleService.findTitlesByid();
		JSONArray comboboxJson = ComboboxUtil.titlecombobox(titles) ;
		ResponseUtil.write(response, comboboxJson);
		return null;
	}
	
}
